<?php
defined('_JEXEC') or die('Restricted access');
?>
<div class="col width-100">
	<table width="100%">
		<?php if(!empty($this->data->member_id)):?>
		<tr>
			<td class="key">
				<label for="title">Member ID assigned</label>
			</td>
			<td>
				<strong><?php echo $this->data->member_id ; ?></strong>
			</td>
		</tr>
		<?php
		 	endif ;
			if(!empty($this->data->l_name) || !empty($this->data->f_name)):
		?>
		<tr>
			<td class="key">
				<label for="title">Member Name</label>
			</td>
			<td>
				<strong><?php echo $this->data->l_name.' '.$this->data->f_name ; ?></strong>
			</td>
		</tr>
		<?php endif ;?>
    	<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['status']['caption']; ?></label>
			</td>
			<td>
				<?php echo $this->lists['status']; ?>
			</td>
			<td class="key" valign="top">
				<label for="title"><?php echo $this->configField['social']['caption']; ?></label>
			</td>
			<td>
				<table>
					<tr>
						<td width="20">
							<input type="checkbox" <?php echo $this->social['facebook'] != ''? 'checked="checked"':'';?> title="type" maxlength="50" size="50" value="facebook" id="facebook" name="social[]" class="facebook" />
						</td>
						<td>FaceBook</td>
						<td width="20"><input type="checkbox" <?php echo $this->social['twitter'] != ''? 'checked="checked"':'';?> title="type" maxlength="50" size="50" value="twitter" id="twitter" name="social[]" class="twitter" /> </td>
						<td>Twitter</td>
						<td width="20"><input type="checkbox" <?php echo $this->social['flickr'] != ''? 'checked="checked"':'';?> title="type" maxlength="50" size="50" value="flickr" id="flickr" name="social[]" class="flickr" /> </td>
						<td>Flickr</td>
						<td width="20"><input type="checkbox" <?php echo $this->social['myspace'] != ''? 'checked="checked"':'';?> title="type" maxlength="50" size="50" value="myspace" id="myspace" name="social[]" class="myspace" /> </td>
						<td>Myspace</td>
						<td width="20"><input type="checkbox" <?php echo $this->social['linkedin'] != ''? 'checked="checked"':'';?> title="type" maxlength="50" size="50" value="linkedin" id="linkedin" name="social[]" class="linkedin" /> </td>
						<td colspan="3">Linkedin</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['website']['caption']; ?></label>
			</td>
			<td>
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->website; ?>" id="website" name="website" class="website" /> 
			</td>
			<td class="key">
				<label for="title"><?php echo $this->configField['skype']['caption']; ?></label>
			</td>
			<td>
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->skype; ?>" id="skype" name="skype" class="skype" /> 
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['msn']['caption']; ?></label>
			</td>
			<td>
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->msn; ?>" id="msn" name="msn" class="msn" /> 
			</td>
			<td class="key">
				<label for="title"><?php echo $this->configField['yahoo']['caption']; ?></label>
			</td>
			<td>
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->yahoo; ?>" id="yahoo" name="yahoo" class="yahoo" /> 
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="title"><?php echo $this->configField['gtalk']['caption']; ?></label>
			</td>
			<td colspan='3'>
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->gtalk; ?>" id="gtalk" name="gtalk" class="gtalk" /> 
			</td>
		</tr>
		
		<!-- Script to show/hide child item -->
		<style type="text/css">
			.d-block{
				display: block ;
			}
			.d-none{
				display: none ;
			}
			.show_o_a_weekend_none{
				display: none ;
			}
			.show_o_a_weekend_block{
				display: block ;
			}
		</style>
		<script type="text/javascript">
		 	jQuery.noConflict();
		   	jQuery(document).ready(function(){
				<?php foreach($this->all_hobbies as $hobbies): ?>
					if(jQuery('#item<?php echo $hobbies->id ; ?>').is(":checked"))
					{
						jQuery('#item<?php echo $hobbies->id ; ?>').removeClass('d-none');
						jQuery('#item<?php echo $hobbies->id ; ?>').addClass('d-block');
						jQuery('.child_item<?php echo $hobbies->id ; ?>').removeClass('d-none');
						jQuery('.child_item<?php echo $hobbies->id ; ?>').addClass('d-block');
					}
					jQuery('#item<?php echo $hobbies->id ; ?>').click(function() {
							if(jQuery('#item<?php echo $hobbies->id ; ?>').is(":checked"))
							{
								jQuery('.child_item<?php echo $hobbies->id ; ?>').removeClass('d-none');
								jQuery('.child_item<?php echo $hobbies->id ; ?>').addClass('d-block');
							}else{
								jQuery('.child_item<?php echo $hobbies->id ; ?>').removeClass('d-block');
								jQuery('.child_item<?php echo $hobbies->id ; ?>').addClass('d-none');
							}
						});
					
				<?php endforeach;?>
				jQuery("#check_o_a_weekend").click(function(){
					if(jQuery('input#check_o_a_weekend').is(':checked')){
						jQuery('#a_weekend_id').removeClass('show_o_a_weekend_none');
						jQuery('#a_weekend_id').addClass('show_o_a_weekend');
		            }else{
		            	jQuery('#a_weekend_id').removeClass('show_o_a_weekend');
		            	jQuery('#a_weekend_id').addClass('show_o_a_weekend_none');
		            }
				});
		   	});
		   	
		</script>
		<tr>
			<td class="key" valign="top">
				<label for="title"><?php echo $this->configField['hobbies']['caption']; ?></label>
			</td>
			<td colspan='3'>
				<table style="padding-left:3px ; ">
					<tr>
					<?php 
					$i=0;
					foreach($this->list_hobbies as $hobbies):
						if(($i!=0) && ($i%5 ==0)):
					?>
						</tr>
						<tr>
					<?php 
						endif;
					?>
						<td>
							<table>
								<tr>
									<td>
										<?php 
											$tt = $hobbies->id;
										?>
										<input type="checkbox" <?php echo $this->u_hobbies[$tt] != ''? 'checked="checked"':'';?> value="<?php echo $hobbies->id; ?>" name="hobbies[]" class="hobbies" id="item<?php echo $hobbies->id ; ?>" />
									</td>
									<td>
										<?php echo $hobbies->hobbies_name; ?>
									</td>
								</tr>
							</table>
						</td>
						
					<?php 
						
						$i++;
					endforeach;
					?>
					</tr>
				</table>
				<table>
					<tr>
						<td>
							<?php 
								foreach($this->all_hobbies as $a_hobbies): 
								$j=0;
								$flag = $this->list_child_hobbies[$a_hobbies->id] ;
								if(count($flag) > 0) : 		
							?>
								<table class="d-none child_item<?php echo $a_hobbies->id ; ?>">
									<tr>
										<td>
											-----------00--<?php echo "<b> ".$this->hobbi_name[$a_hobbies->id]->title." </b>" ; ?>--00-----------
										</td>
									</tr>
								</table>
								<table>
									<tr>
										<?php  
										foreach($flag as $child_hobbies):
											if(($j!=0) && ($j%5 ==0)):
										?>
											</tr>
											<tr>
										<?php 
											endif;
										?>
											<td>
												<table class="d-none child_item<?php echo $child_hobbies->parent_id ; ?>">
													<tr>
														<td>
															<input type="checkbox" <?php echo $this->u_hobbies[$child_hobbies->id] != ''? 'checked="checked"':'';?> value="<?php echo $child_hobbies->id ; ?>" name="hobbies[]" class="hobbies" id="item<?php echo $child_hobbies->id ; ?>" />
														</td>
														<td>
															<?php echo $child_hobbies->hobbies_name ; ?>
														</td>
													</tr>
												</table>
											</td>
										<?php 
											$j++;
											endforeach;
										?>
									</tr>
								</table>
							<?php 
								endif ;
								endforeach;
							?>
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td id="show_o_hobbies" >
				<a href="javascript::void();" onclick = "showOtherHobbies('o_hobbies','show_o_hobbies');">
					<label for="title" style='cursor: pointer ;'>
						<?php echo $this->configField['other_hobbies']['caption']; ?>
					</label>
				</a>
			</td>
			<td id="o_hobbies" style="<?php if(empty($this->data->other_hobbies)){ echo 'display:none';}else{ echo 'display:block';}?>">
				<input type="text" title="type" maxlength="50" size="50" value="<?php echo $this->data->other_hobbies; ?>" id="other_hobbies" name="other_hobbies" class="other_hobbies" />
			</td>
			<td colspan='2'>
				<table>
					<tr>
						<td>
							<label style='margin-top:0px;' for="title">
								<?php echo $this->configField['own_car']['caption']; ?>
							</label>
						</td>
						<td>
							<input type="radio" <?php if($this->data->own_car == 1){ echo "checked='checked'" ; } ?> maxlength="50" size="50" value="1" name="own_car" />
						</td>
						<td>Yes</td>
						<td>
							<input type="radio" <?php if($this->data->own_car == 0){ echo "checked='checked'" ; } ?> maxlength="50" size="50" value="0" name="own_car" />
						</td>
						<td>No</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<label for="title"><?php echo $this->configField['num_children']['caption']; ?></label>
			</td>
			<td colspan='3'>
				<?php echo $this->lists['numChild']; ?>
			</td>
		</tr>
		<tr>
			<td>
				<label for="title"><?php echo $this->configField['weekend_action']['caption']; ?></label>
			</td>
			<td colspan='3'>
				<?php //echo $this->lists['actionWeekend']; ?>
                        <table style="padding-left:3px ; ">
					<tr>
					<?php 
					$tr=0;
					foreach($this->list_aweekend as $aweekend):
						if(($tr!=0) && ($tr%5 ==0)):
					?>
						</tr>
						<tr>
					<?php 
						endif;
					?>
						<td>
							<table>
								<tr>
									<td>
										<?php 
											$trt = $aweekend->value;
										?>
										<input type="checkbox" <?php echo $this->u_act_w[$aweekend->value] != ''? 'checked="checked"':'';?> value="<?php echo $aweekend->value ; ?>" name="weekend_action[]" class="aweekend" id="item<?php echo $aweekend->value ; ?>" />
									</td>
									<td>
										<?php echo $aweekend->text; ?>
									</td>
								</tr>
							</table>
						</td>
						
					<?php 
						
						$tr++;
					endforeach;
					if(($tr!=0) && ($tr%5 ==0)):
					?>
					</tr>
						<tr>
							<td>
								<table>
									<tr>
										<td>
										<?php 
											$able = trim($this->data->o_a_weekend) ;
											if(!empty($able) || $able!=''){
												$checked = ' checked="checked"' ; 
												$disp = 'show_o_a_weekend' ;
											}else{
												$checked = '' ;
												$disp = 'show_o_a_weekend_none' ;
											}
										?>
											<input type="checkbox" <?php echo $checked ?> value="" id='check_o_a_weekend' name='check_o_a_weekend' />
										</td>
										<td>Others</td>
									</tr>
								</table>
							</td>
					<?php 
					else:
					?>
						<td>
							<table>
								<tr>
									<td>
										<?php 
											$able = trim($this->data->o_a_weekend) ;
											if(!empty($able) || $able!=''){
												$checked = ' checked="checked"' ; 
												$disp = 'show_o_a_weekend' ;
											}else{
												$checked = '' ;
												$disp = 'show_o_a_weekend_none' ;
											}
										?>
										<input type="checkbox" <?php echo $checked ; ?> value="" id='check_o_a_weekend' name='check_o_a_weekend' />
									</td>
									<td>Others</td>
								</tr>
							</table>
						</td>
					<?php 	
					endif;
					?>
					</tr>
				</table>
			</td>
		</tr>
		<tr id="a_weekend_id" class="<?php echo $disp ; ?>">
			<td>&nbsp;</td>
			<td style='padding-left: 30px;' colspan='3'>
				<input type="text" value="<?php echo $this->data->o_a_weekend ; ?> " id='o_a_weekend' size="45" maxlength="45" name='o_a_weekend' />
			</td>
		</tr>
		<tr>
			<td colspan='4'>
				<a href="javascript:void(null)" onclick="javascript:Joomla.submitbutton('apply')">
					<img title="Save & Next" style="float: right ;" src="<?php echo JURI::base() .'/components/com_wrd/assets/images/save_next.png'?>">
				</a>
			</td>
		</tr>
	</table>
</div>